import { BasicColumn, FormSchema } from "/@/components/Table"
import { rules } from "/@/utils/helper/validator"
import { render } from "/@/utils/common/renderUtils"

export enum ConfigPageType {
  JSON = "1",
  CUSTOM = "2",
}

export const columns: BasicColumn[] = [
  {
    title: "接口名称",
    width: 100,
    dataIndex: "ifName",
  },
  {
    title: "接口代码",
    width: 100,
    dataIndex: "ifCode",
  },
  {
    title: "状态",
    width: 50,
    dataIndex: "status",
    customRender: ({ text }) => {
      let color = "green"
      if (text == "0") color = "#FFCC33"
      if (text == "1") color = "green"

      return render.renderTag(render.renderDict(text, "data_use_status"), color)
    },
  },
  {
    title: "创建时间",
    width: 100,
    dataIndex: "createdAt",
  },
]

export const commonFromSchema: FormSchema[] = [
  {
    field: "id",
    label: "支付接口配置",
    component: "Input",
    show: false,
  },
  {
    field: "status",
    label: "状态",
    component: "JDictSelectTag",
    required: true,
    colProps: { span: 12 },
    // defaultValue: '0',
    componentProps: {
      type: "radio",
      dictType: "data_use_status",
    },
  },
  {
    field: "enableCheckBill",
    label: "是否开启对账",
    component: "RadioGroup",
    colProps: { span: 12 },
    required: true,
    componentProps: {
      options: [
        {
          label: "是",
          value: true,
        },
        {
          label: "否",
          value: false,
        },
      ],
    },
  },

  {
    field: "remark",
    label: "备注",
    component: "InputTextArea",
  },
]
